package com.eonmind.common.provider.entity.ai;

import com.eonmind.common.contract.enums.DelEnum;
import com.eonmind.common.contract.enums.ai.AiArtworkStatusEnum;
import com.eonmind.common.contract.enums.ai.AiDrwaPlatformTypeEnum;
import com.eonmind.common.contract.timer.Timer;
import com.mongoplus.annotation.ID;
import com.mongoplus.annotation.collection.CollectionName;
import com.mongoplus.annotation.index.MongoIndex;
import com.mongoplus.enums.IdTypeEnum;
import lombok.*;
import lombok.experimental.FieldNameConstants;

import java.util.ArrayList;
import java.util.List;

/**
 * AI绘画任务
 *
 * @author Xujie
 * @since 2025/5/5 11:25
 **/
@Data
@CollectionName("aiArtwork")
@FieldNameConstants
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ToString
public class AiArtwork {
    /**
     * 绘画任务id
     */
    @ID(type = IdTypeEnum.AUTO)
    private Long id;

    /**
     * 第三方平台任务id
     */
    private String taskId = "";

    /**
     * 平台类型
     */
    private Integer platformType = AiDrwaPlatformTypeEnum.MJ.getCode();


    /**
     * 用户ID
     */
    @MongoIndex
    private Long userId = 0L;

    /**
     * 平台ID
     */
    @MongoIndex
    private Long platformId = 0L;


    /**
     * 绘画任务提示词
     */
    @MongoIndex
    private String prompt = "";

    /**
     * 绘画任务风格
     */
    @MongoIndex
    private String imgStyle = "";

    /**
     * 绘画任务图片高度
     */
    @MongoIndex
    private Integer imgHeight = 0;

    /**
     * 图片比例
     */
    private String ratio = "";

    /**
     * 绘画任务图片宽度
     */
    @MongoIndex
    private Integer imgWeight = 0;

    /**
     * 额外的参数
     */
    private String extraJson = "";

    /**
     * 绘画任务图片数量
     */
    @MongoIndex
    private Integer imgNum = 1;

    /**
     * 绘画任务图片地址
     */
    @MongoIndex
    private List<String> imgList = new ArrayList<>();

    /**
     * 绘画任务进度
     */
    private String progress = "0%";

    /**
     * 失败原因
     */
    private String failReason = "";


    /**
     * 绘画任务状态
     */
    @MongoIndex
    private Integer status = AiArtworkStatusEnum.PENDING_GENERATION.getCode();

    /**
     * 创建时间
     */
    private Long createTime = Timer.currentTimestamp();

    /**
     * 更新时间
     */
    private Long updateTime = Timer.currentTimestamp();

    /**
     * 删除状态
     */
    @MongoIndex
    private Integer del = DelEnum.UN_DEL.getCode();
}
